package com.wuuxiang.polestar.core.spring.surpass;

import com.wuuxiang.polestar.core.zookeeper.surpass.ZookeeperSurPassConfigProfile;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;

/**
 * 项目名称：polestar        <br>
 * 类描述：                         <br>
 * 创建人：夏鸿鹏                    <br>
 * 创建时间：2017-12-5 15:09        <br>
 * 修改备注：                        <br>
 */

public class ZookeeperSurPassConfigProfileConfigBean extends AbstractSingleBeanDefinitionParser {

    @Override
    protected Class<?> getBeanClass(Element element) {
        return ZookeeperSurPassConfigProfile.class;
    }

    @Override
    protected void doParse(Element element, BeanDefinitionBuilder builder) {
        // zookeeper地址
        String connectStr = element.getAttribute("connect-str");
        builder.addConstructorArgValue(connectStr);
        // 项目组名
        String teamName = element.getAttribute("team-name");
        builder.addConstructorArgValue(teamName);
        // 是否加载默认分组配置
        String isLoadDef = element.getAttribute("load-def");
        builder.addConstructorArgValue(isLoadDef);
    }
}
